#!/usr/bin/env python

########################################################
# Part of MILIM NIRDAFOT project.
# Written by H. Magal, 2014
# See details on the project at the site:
#   https://sites.google.com/site/nirdafotdownloads/home
########################################################

# This script creates the file 'nirdafotEngine.xx.yy.tar.gz' which is uploaded to 'sites.google.com'
# Call it without any command line arguments. The version number is taken from constants.py. When you
# update version, don't forget to update nirdafot.xml file too, and upload it to Goole sites as well !


import tarfile
import constants

def write_final_tar ():
    # create a tuple with the files to be TARed
    files = ('constants.py', 'full_list_frame.py', 'hebrew_fixed_texts.py',\
             'init.py', 'syng_main.py', 'synonymDB.py',\
             'GPLv3.Hebrew.UTF8.txt', 'GPLv3_license_acceptance.py', 'tech_support.py',
             'Flag_of_Israel.ico')

    # the name 'nirdafotEngine.' is a notation known to the SW upgrade module
    # (setup.py), so dont change it !
    tar_name = 'nirdafotEngine.' + constants.__version__ + '.tar.gz'
    tarout = tarfile.open (name=tar_name, mode='w:gz')
    for f in files:
        tarout.add (name=f)
    tarout.close ()


if __name__ == '__main__':
    write_final_tar ()